import React from 'react';
import ReactDOM from 'react-dom';
import QRCode from 'qrcode.react';
import mirror, {actions, connect} from 'mirrorx';
import { Button } from 'antd-mobile';

class App extends React.Component { 
	constructor(props) {
		super(props);
        this.state = {
            data: {
                serviceNo: T.urlQuery('serviceNo'),
                policyId: T.urlQuery('policyId'),
                customerId: T.urlQuery('customerId'),
                serviceCode: T.urlQuery('serviceCode'),
            },
        }
	}

	componentDidMount(){

    }
   
    handleBack = () => {
        actions.routing.go(-1);
    }

    // 查询是否扫码消费成功
    request = () => {
        T.fetch({
            url:'/facilitator/service/getConsumptionNotice.json',
            data: {
                orderNo: T.urlQuery('orderNo'),
                recordsKey: T.urlQuery('recordsKey')
            },
        }).then((res)=>{
            if(res.success){
                if(res.value.computeResult != '0'){
                    this.setState({
                        data: res.value,
                        showSuccess: res.success
                    })
                }
            }
        })
    }

	render() {
        const {data} = this.state;
        const Lang = window.LangMessage ||{};
		return (
            <div>
                <div className="tac mt30">
                    <QRCode value={`${JSON.stringify(data)}`} size={250} />
                </div>
                <div className="tac mt50">
                    <Button size="large" type="primary" onClick={this.handleBack}>{Lang.return || '返回'}</Button>
                </div>
            </div>
        )
	}
}

export default App;